fix: allow deleting last clip per recording segment in Studio Mode#1848
Merged
richiemcilroy merged 1 commit intoMay 20, 2026
Merged
Conversation
Contributor
Author
|
hey @richiemcilroy, have a look at this when you get chance and let me know if any changes required |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR fix?
Fixes #1695, users were unable to delete clips in Studio Mode after pausing a camera-only recording.
Root cause
deleteClipSegmentincontext.tshad a guard that prevented deletion when fewer than 2 timeline segments shared the samerecordingSegmentindex (i.e., the same pause interval).This meant the "last" clip from any paused segment became permanently undeletable, even when other segments remained in the timeline.
The
ConfigSidebar.tsxDelete button used the same incorrect condition to disable itself.Additionally, the condition
!segment.recordingSegment === undefinedin the original guard was alwaysfalse(boolean vs.undefinedcomparison) — dead code that never fired.Changes
context.ts: UpdateddeleteClipSegmentguard — now only blocks deletion when it would leave the timeline completely empty (segments.length < 2), rather than blocking when it's the last clip of a specific recording segment.ConfigSidebar.tsx: Updated the Delete buttondisabledprop to use the same corrected logic.Testing
Greptile Summary
This PR fixes a bug where clips in a paused camera-only recording segment could not be deleted in Studio Mode. The root cause was a guard that blocked deletion whenever fewer than two clips shared the same
recordingSegmentindex, and a dead-code condition (!segment.recordingSegment === undefined) that always evaluated tofalse.context.ts: ThedeleteClipSegmentguard now only prevents deleting when one segment remains in the entire timeline (segments.length < 2), removing both the dead boolean-vs-undefinedcomparison and the per-recording-segment filter.ConfigSidebar.tsx: The Delete button'sdisabledprop is updated to match the new guard, ensuring UI state stays in sync with the action's actual behavior.Confidence Score: 5/5
The change is safe to merge — it relaxes an overly strict guard and aligns the UI disabled state with the action logic.
Both modified sites (the action guard and the button disabled prop) are now consistent with each other and with the intended behavior: only the very last timeline segment is protected from deletion. The removed dead-code condition never fired, so its removal has no side effects.
No files require special attention.
Important Files Changed
deleteClipSegmentsimplified: dead-code boolean-vs-undefined comparison removed and per-recording-segment filter replaced with a global segment count check (< 2).disabledprop updated to mirror the corrected guard incontext.ts, now using total segment count instead of per-recording-segment count.Reviews (1): Last reviewed commit: "fix: allow deleting last clip per record..." | Re-trigger Greptile